const path = require('path');
const { merge } = require('webpack-merge');

module.exports = merge(
  {},
  {
    target: ['web', 'es6'],
    resolve: {
      extensions: ['.ts', '.js'],
    },
    entry: {
      main: path.resolve(__dirname, '../src/index.ts'),
    },
    output: {
      path: path.resolve(__dirname, '../dist'),
    },
    module: {
      rules: [
        {
          test: /\.ts$/,
          use: 'ts-loader',
          exclude: /node_modules/,
        },
        {
          // Для TypeScript модули определены в этом файле /src/assets.d.ts
          test: /\.(ico|jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|m4a|mp3)$/,
          type: 'asset/resource',
        },
      ],
    },
  }
);
